// api/registration.js - 报名相关API
const api = require('../utils/api.js')

/**
 * 提交报名
 */
function submitRegistration(activityId, data) {
  return api.post(`/activities/${activityId}/registrations`, data)
}

/**
 * 获取报名列表
 */
function getRegistrationList(activityId, params = {}) {
  return api.get(`/activities/${activityId}/registrations`, params)
}

/**
 * 获取报名详情
 */
function getRegistrationDetail(id) {
  return api.get(`/registrations/${id}`)
}

/**
 * 获取我的报名记录
 */
function getMyRegistrations(params = {}) {
  return api.get('/user/registrations', params)
}

/**
 * 审核报名
 */
function reviewRegistration(id, status, feedback = '') {
  return api.post(`/registrations/${id}/review`, {
    status: status,
    feedback: feedback
  })
}

/**
 * 批量审核报名
 */
function batchReviewRegistrations(ids, status, feedback = '') {
  return api.post('/registrations/batch-review', {
    ids: ids,
    status: status,
    feedback: feedback
  })
}

/**
 * 导出报名数据
 */
function exportRegistrations(activityId) {
  return api.get(`/activities/${activityId}/registrations/export`)
}

module.exports = {
  submitRegistration,
  getRegistrationList,
  getRegistrationDetail,
  getMyRegistrations,
  reviewRegistration,
  batchReviewRegistrations,
  exportRegistrations
}

